<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="utf-8"%>
<%@taglib prefix="s" uri="/struts-tags" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>修改用户</title>
<jsp:include page="../iframecommon.jsp"></jsp:include>
<script type="text/javascript">
function validate(){
	var phone_pattern=/^(((13[0-9]{1})|15[0-9]{1}|18[0-9]{1}|17[0-9]{1}|)+\d{8})$/;
	var email_pattern=/^[a-z]([a-z0-9]*[-_]?[a-z0-9]+)*@([a-z0-9]*[-_]?[a-z0-9]+)+[\.][a-z]{2,4}([\.][a-z]{2})?$/i;
	var re = /^1\d{10}$/;
	var passwd = document.getElementById("pwd1").value;
	var repasswd = document.getElementById("pwd2").value;
	var realname= document.getElementById("realname").value;
	var phone= document.getElementById("phone").value;
	var email= document.getElementById("email").value;
	if(0==realname.length)
	{
		window.alert("真实姓名不能为空！");
		return false;
	}
	if(0==phone.length)
	{
		window.alert("手机号码不能为空！");
		return false;
	}
	else
	{
		if(phone_pattern.test(phone)==false)
		{
			window.alert("手机号码位数不正确，请输入正确的手机号码！");
			return false;
		}
	}
	if((0==email.length))
	{
		window.alert("邮箱地址不能为空！");
		return false;
	}else
	{
		if(email_pattern.test(email)==false)
			{
			window.alert("邮箱地址错误，请输入正确的邮箱地址！");
			return false;
			}
	}
	if(0==passwd.length)
	{//passwd为空  请输入密码
		window.alert("登录密码不能为空！");
		return false;
	}else
	{ if(0==repasswd.length)//repasswd  请确认密码
		{
		window.alert("确认密码不能为空！");
		return false;
		}else
			{
			if(passwd != repasswd)
			    {
				window.alert("两次输入密码不一致");
				return false;
				}
			}
	}
	return true;
}

function checkpasswd(){
var re = /^1\d{10}$/;
var passwd = document.getElementById("pwd1").value;
var repasswd = document.getElementById("pwd2").value;
if(passwd == repasswd){
return true;
}else{
window.alert("两次输入密码不一致");
return false;
}
}
</script>
</head>
<body>

<div class="col-lg-3"></div>
<div class="col-lg-6">
<header class="main-box-header clearfix">
<h1>修改个人资料</h1>
</header>
<div class="alert alert-success">
<i class="fa fa-check-circle fa-fw fa-lg"></i>
修改任何资料均需要重复输入密码以验证身份，用户名和用户真实姓名一经设定不可修改
</div>
<div class="main-box">
<form action="user_updateUser" method="post"  class="form-group" >
	<label for="1">用户名</label>
	<s:textfield   name="usernow.id"  readonly="true" cssClass="form-control" id="1"></s:textfield>
	
	<hr>
	<label for="2">性别</label>
	<s:radio name="usernow.gender" list="#{true:'男',false:'女'}" label="性别" id="2"></s:radio>
	<hr>
	<label for="pwd1">密码</label>
	<s:textfield id="pwd1" name="usernow.password" type="password" label="密码"  cssClass="form-control" ></s:textfield>
	<label for="pwd2">确认密码</label>
	<s:textfield id="pwd2"  type="password" label="密码"  cssClass="form-control" ></s:textfield>
	<label for="phone">手机号码</label>
	<s:textfield id="phone" name="usernow.phone" label="电话"  cssClass="form-control" ></s:textfield>
	<label for="email">电子邮箱</label>
	<s:textfield id="email" name="usernow.email" label="邮件"  cssClass="form-control" ></s:textfield>
	<label for="realname">真实姓名</label>
	<s:textfield id="realname" name="usernow.realname" readonly="true" label="真实姓名"  cssClass="form-control" ></s:textfield>
	<s:hidden name="usernow.role"/>
	<s:hidden name="usernow.isvalid"/>
	
	<input type="submit" value="提交修改" class="btn btn-success" onclick="return validate()"/>
</form>
</div></div>
<div class="col-lg-3"></div>
</body>
</html>